﻿using System;
using System.Collections.Generic;

// Done

namespace Framework
{
    public class Geometry : Base
    {
        public static Geometry Empty;

        static Geometry()
        {
            RegisterType(typeof(Geometry));
            RegisterProp(typeof(Geometry), "Transform", typeof(Transform), null);
        }

        public Rect Bounds { get; set; }

        public Double StandardFlatteningTolerance { get { return 0.25; } }
    }

    public sealed class GeometryGroup : Geometry
    {
        static GeometryGroup()
        {
            RegisterType(typeof(GeometryGroup), typeof(Geometry));
            RegisterProp(typeof(GeometryGroup),"FillRule", typeof(FillRule), null );
            RegisterProp(typeof(GeometryGroup), "Children", typeof(Collection<Geometry>),null);
        }
    }
    
    public sealed class EllipseGeometry : Geometry
    {
        static EllipseGeometry()
        {
            RegisterType(typeof(EllipseGeometry), typeof(Geometry));
            RegisterProp(typeof (EllipseGeometry), "Point", typeof (Point), null);
            RegisterProp(typeof (EllipseGeometry), "RadiusX", typeof (Double), null);
            RegisterProp(typeof(EllipseGeometry) ,"RadiusY", typeof(Double), null);
        }
    }

    public sealed  class RectangleGeometry : Geometry
    {
        static RectangleGeometry()
        {
            RegisterType(typeof (RectangleGeometry), typeof (Geometry));
            RegisterProp(typeof (RectangleGeometry), "Rect", typeof (Rect), null);
            RegisterProp(typeof (RectangleGeometry), "RadiusX", typeof (Double), null);
            RegisterProp(typeof (RectangleGeometry), "RadiusY", typeof (Double), null);
        }
    }

    public sealed class LineGeometry : Geometry
    {
        static LineGeometry()
        {
            RegisterType(typeof (LineGeometry), typeof (Geometry));
            RegisterProp(typeof (LineGeometry), "StartPoint", typeof (Point), null);
            RegisterProp(typeof(LineGeometry), "EndPoint", typeof(Point), null);
        }
    }

    public sealed class PathGeometry : Geometry
    {
        static PathGeometry()
        {
            RegisterType(typeof(PathGeometry), typeof(Geometry));
            RegisterProp(typeof (PathGeometry), "FillRule", typeof (FillRule), null);
            RegisterProp(typeof(PathGeometry), "Figures", typeof(Collection<PathFigure>), null);
        }
    }
    
    public abstract class PathSegment : Base
    {
    }
 
    public sealed class PathFigure : Base
    {
        static PathFigure()
        {
            RegisterType(typeof(PathFigure));
            RegisterProp(typeof(PathFigure), "Segments", typeof(Collection<PathSegment>), null);
            RegisterProp(typeof (PathFigure), "StartPoint", typeof (Point), null);
            RegisterProp(typeof(PathFigure), "IsClosed", typeof(bool), null);
            RegisterProp(typeof(PathFigure), "IsFilled", typeof(bool), null);
        }
    }
    
    public sealed class ArcSegment : PathSegment
    {
        static ArcSegment()
        {
            RegisterType(typeof(ArcSegment), typeof(PathSegment));
            RegisterProp(typeof(ArcSegment), "Point", typeof(Point), null);
            RegisterProp(typeof(ArcSegment), "RotationAngle", typeof(Double), null);
            RegisterProp(typeof(ArcSegment), "IsLargeArc", typeof(Boolean), null);
            RegisterProp(typeof(ArcSegment), "SweepDirection", typeof(SweepDirection), null);
            RegisterProp(typeof(ArcSegment), "Size", typeof(Size), null);
        }
    }

    public sealed class BezierSegment : PathSegment
    {
        static BezierSegment()
        {
            RegisterType(typeof(BezierSegment), typeof(PathSegment));
            RegisterProp(typeof (BezierSegment), "Point1", typeof (Point), null);
            RegisterProp(typeof(BezierSegment),"Point2", typeof(Point),null);
            RegisterProp(typeof(BezierSegment), "Point3", typeof(Point), null);
        }
    }

    public sealed class LineSegment : PathSegment
    {
        static LineSegment()
        {
            RegisterType(typeof(LineSegment), typeof(PathSegment));
            RegisterProp(typeof(LineSegment), "Point", typeof(Point), null);
        }
    }
    
    public sealed class PolyBezierSegment : PathSegment
    {
        static PolyBezierSegment()
        {
            RegisterType(typeof(PolyBezierSegment), typeof(PathSegment));
            RegisterProp(typeof(PolyBezierSegment),"Points", typeof(Collection<Point>), null);
        }
    }

    public sealed class PolyLineSegment : PathSegment
    {
        static PolyLineSegment()
        {
            RegisterType(typeof(PolyLineSegment), typeof(PathSegment));
            RegisterProp(typeof(PolyLineSegment), "Points", typeof(Collection<Point>), null);
        }
    }

    public sealed class PolyQuadraticBezierSegment : PathSegment
    {
        static PolyQuadraticBezierSegment()
        {
            RegisterType(typeof (PolyQuadraticBezierSegment), typeof (PathSegment));
            RegisterProp(typeof(PolyQuadraticBezierSegment), "Points", typeof(Collection<Point>), null);
        }
    }

    public sealed class QuadraticBezierSegment : PathSegment
    {
        static QuadraticBezierSegment()
        {
            RegisterType(typeof (QuadraticBezierSegment), typeof (PathSegment));
            RegisterProp(typeof(QuadraticBezierSegment), "Point1", typeof(Point), null);
            RegisterProp(typeof(QuadraticBezierSegment), "Point2", typeof(Point), null);
        }
    }
}
